Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render schema attributes if attributes object is passed in GET /schema/all #1763

Merged

Conversation

Shoaibdev7
Copy link
Contributor

@Shoaibdev7 Shoaibdev7 commented Jul 3, 2024

Problem:

  • Everywhere we call GET /schema/all we need to add the additional logic to render attributes in Blueprint (or add item flow):
  • if attributes property is passed, only render attributes inside object
  • else, do what we currently do

closes: #1756

Issue ticket number and link:

Evidence:

image

image

@Shoaibdev7
Copy link
Contributor Author

Hi @Rassl, @tomsmith8
Please review this PR.

@Shoaibdev7
Copy link
Contributor Author

Same me side:
#1759 (comment)

@Rassl Rassl self-requested a review July 5, 2024 15:28
Copy link
Collaborator

@Rassl Rassl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Shoaibdev7 looks like there is misundertanding, we should not update all schema in store, only here src/components/ModalsContainer/BlueprintModal/Body/Editor/CustomAttributesStep/FormInput/index.tsx and here src/components/AddItemModal/SetAttributesStep/index.tsx we should render props either from attributes, or the old way

@@ -43,7 +43,18 @@ export const Body = () => {

const filteredSchemas = response.schemas.filter((i) => i.ref_id && !i.is_deleted)

setSchemaAll(filteredSchemas.length > 0 ? filteredSchemas : response.schemas)
const processedSchemas = filteredSchemas.map((schema) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not what we need to do

Copy link
Contributor Author

@Shoaibdev7 Shoaibdev7 Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rassl, Ok i check it and fix it

@Shoaibdev7
Copy link
Contributor Author

Hi @Rassl Please review this PR.

@Shoaibdev7 Shoaibdev7 requested a review from Rassl July 7, 2024 00:11
@Shoaibdev7
Copy link
Contributor Author

@Rassl Please review this PR.

@tomsmith8
Copy link
Contributor

@Rassl How we looking on this one.

I noticed today primary_color is returned.

However response is:

{
            "attributes": {
                "age": "int",
                "name": "string"
            },
            "node_key": "name-age",
            "parent": "Thing",
            "primary_color": "#076952",
            "ref_id": "dd5e410a-ac2e-4eaf-bf27-da9fd1973e61",
            "type": "Person"
        }

Therefore should jsut render attributes

Screenshot 2024-07-24 at 12 19 27

@sophieturner0
Copy link
Contributor

@tomsmith8, I think we should also hide "primary_color": "#076952" on the frontend side, similar to how we hide "node_key": "name-age".

@tomsmith8
Copy link
Contributor

No, we should only render whats inside 'attributes'

Then we don't have to do manual checks

Copy link
Collaborator

@Rassl Rassl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Rassl Rassl merged commit a2991c2 into stakwork:master Jul 24, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Render schema attributes if attributes object is passed in GET /schema/all
4 participants